package com.jltx.storage.downloader.util;

import io.reactivex.disposables.Disposable;

/**
 * @author jltxseo
 * Created by junlintianxia on 2018/09/26.
 */
public class RxTask<T> {
    private T t;

    private Disposable disposable;

    public RxTask() {
    }

    public RxTask(T t) {
        this.t = t;
    }

    public T getT() {
        return t;
    }

    public void setT(T t) {
        this.t = t;
    }

    public void setDisposable(Disposable disposable) {
        this.disposable = disposable;
    }

    /**
     * 在io线程回调
     */
    public void doOnRxIOThread() {
    }

    /**
     * 在主线程回调
     */
    public void doOnRxUIThread() {
    }

    /**
     * 取消RxTask任务
     */
    public void cancel() {
        if (disposable != null) {
            disposable.dispose();
        }
    }
}
